<?php
class Cellphonezone_Paymentmail_Block_Adminhtml_Info_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {        
        $id = $this->getRequest()->getParam('id');
        $form = new Varien_Data_Form(array(
                                      'id' => 'edit_form',
                                      'method' => 'post',
                                      'enctype' => 'multipart/form-data'
                                   ) );

        $fieldset = $form->addFieldset('paymentmail',
                    array(
                        'legend'    => Mage::helper('paymentmail')->__('Payment Form Info')
                    ) );

        if ($id){
           $paymentmail = Mage::registry('paymentmail_data'); 
           $fieldset->addField('form_type', 'text',
                        array(
                            'name'      => 'form_type',
                            'label'     => Mage::helper('paymentmail')->__('From Type'),
                            'readonly' => true
                        ) );
           $fieldset->addField('login_email', 'text',
                        array(
                            'name'      => 'login_email',
                            'label'     => Mage::helper('paymentmail')->__('Login Email'),
                            'readonly' => true
                        ) );
           $fieldset->addField('order_no', 'text',
                        array(
                            'name'      => 'order_no',
                            'label'     => Mage::helper('paymentmail')->__('Order No'),
                            'readonly' => true
                        ) );
           $fieldset->addField('mtcn_no', 'text',
                        array(
                            'name'      => 'mtcn_no',
                            'label'     => Mage::helper('paymentmail')->__('MTCN No Or Money Gram Card No '),
                            'readonly' => true
                        ) );
           $fieldset->addField('from_bank', 'text',
                        array(
                            'name'      => 'from_bank',
                            'label'     => Mage::helper('paymentmail')->__('From Bank'),
                            'readonly' => true
                        ) );
           $fieldset->addField('to_bank', 'text',
                        array(
                            'name'      => 'to_bank',
                            'label'     => Mage::helper('paymentmail')->__('To Bank'),
                            'readonly' => true
                        ) );
           $fieldset->addField('sent_amount', 'text',
                        array(
                            'name'      => 'sent_amount',
                            'label'     => Mage::helper('paymentmail')->__('Sent Amount'),
                            'readonly' => true
                        ) );
           $fieldset->addField('url', 'link',
                        array(
                            'name'      => 'url',
                            'label'     => Mage::helper('paymentmail')->__('Url'),
                            'readonly' => true,
                            'href'=>$paymentmail->getUrl()
                        ) );
           $fieldset->addField('file', 'link',
                        array(
                            'name'      => 'file',
                            'label'     => Mage::helper('paymentmail')->__('File'),
                            'readonly' => true,
                            'href'=> $this->getUrl('*/*/down',array('file'=>$paymentmail->getFile()))
                        ) );
           $fieldset->addField('refer_no', 'text',
                        array(
                            'name'      => 'refer_no',
                            'label'     => Mage::helper('paymentmail')->__('Refer No'),
                            'readonly' => true
                        ) );
           $fieldset->addField('firstname', 'text',
                        array(
                            'name'      => 'firstname',
                            'label'     => Mage::helper('paymentmail')->__('FirstName'),
                            'readonly' => true
                        ) );
           $fieldset->addField('lastname', 'text',
                        array(
                            'name'      => 'lastname',
                            'label'     => Mage::helper('paymentmail')->__('LastName'),
                            'readonly' => true
                        ) );
           $fieldset->addField('country', 'text',
                        array(
                            'name'      => 'country',
                            'label'     => Mage::helper('paymentmail')->__('Country'),
                            'readonly' => true
                        ) );
           $fieldset->addField('test_question', 'text',
                        array(
                            'name'      => 'test_question',
                            'label'     => Mage::helper('paymentmail')->__('Test Question'),
                            'readonly' => true
                        ) );
           $fieldset->addField('test_answer', 'text',
                        array(
                            'name'      => 'test_answer',
                            'label'     => Mage::helper('paymentmail')->__('Test Answer'),
                            'readonly' => true
                        ) );
          

        } 
        if (Mage::getSingleton('adminhtml/session')->getPaymentmailData()){
            $form->setValues( Mage::getSingleton('adminhtml/session')->getPaymentmailData());
            Mage::getSingleton('adminhtml/session')->setPaymentmailData(null);
        } elseif ( Mage::registry('paymentmail_data') ){
            $form->setValues( Mage::registry('paymentmail_data')->getData() );
        }

        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
}

